<template>
	<view>
		<component :is="isShowIndex" ref="myChildComponentOne"></component>
		<!-- <tab-bar-view :tabCode="'1'"></tab-bar-view> -->
	</view>
</template>

<script>
	import energyAnalysisThreeBuildOneFloor from "@/components/dormThreeBuildingOneFloor/energyAnalysis/index.vue"
	import energyAnalysisThreeBuildTwoFloor from "@/components/dormThreeBuildingTwoFloor/energyAnalysis/index.vue"
	import energyAnalysisThreeBuildThreeFloor from "@/components/dormThreeBuildingThreeFloor/energyAnalysis/index.vue"
	import energyAnalysisThreeBuildFourFloor from "@/components/dormThreeBuildingFourFloor/energyAnalysis/index.vue"
	import energyAnalysisThreeBuildFiveFloor from "@/components/dormThreeBuildingFiveFloor/energyAnalysis/index.vue"

	import energyAnalysisTwoBuildOneFloor from "@/components/dormTwoBuildingOneFloor/energyAnalysis/index.vue"
	import energyAnalysisTwoBuildTwoFloor from "@/components/dormTwoBuildingTwoFloor/energyAnalysis/index.vue"
	import energyAnalysisTwoBuildThreeFloor from "@/components/dormTwoBuildingThreeFloor/energyAnalysis/index.vue"
	import energyAnalysisTwoBuildFourFloor from "@/components/dormTwoBuildingFourFloor/energyAnalysis/index.vue"
	import energyAnalysisTwoBuildFiveFloor from "@/components/dormTwoBuildingFiveFloor/energyAnalysis/index.vue"

	import energyAnalysisOneBuildOneFloor from "@/components/dormOneBuildingOneFloor/energyAnalysis/index.vue"
	import energyAnalysisOneBuildTwoFloor from "@/components/dormOneBuildingTwoFloor/energyAnalysis/index.vue"
	import energyAnalysisOneBuildThreeFloor from "@/components/dormOneBuildingThreeFloor/energyAnalysis/index.vue"
	import energyAnalysisOneBuildFourFloor from "@/components/dormOneBuildingFourFloor/energyAnalysis/index.vue"
	import energyAnalysisOneBuildFiveFloor from "@/components/dormOneBuildingFiveFloor/energyAnalysis/index.vue"
	
	import energyAnalysisOneBuildEle from "@/components/electricianOneBuild/energyAnalysis/index.vue"
	import energyAnalysisTwoBuildEle from "@/components/electricianTwoBuild/energyAnalysis/index.vue"
	import energyAnalysisThreeBuildEle from "@/components/electricianThreeBuild/energyAnalysis/index.vue"
	export default {
		components: {
			energyAnalysisThreeBuildOneFloor,
			energyAnalysisThreeBuildTwoFloor,
			energyAnalysisThreeBuildThreeFloor,
			energyAnalysisThreeBuildFourFloor,
			energyAnalysisThreeBuildFiveFloor,
			energyAnalysisTwoBuildOneFloor,
			energyAnalysisTwoBuildTwoFloor,
			energyAnalysisTwoBuildThreeFloor,
			energyAnalysisTwoBuildFourFloor,
			energyAnalysisTwoBuildFiveFloor,
			energyAnalysisOneBuildOneFloor,
			energyAnalysisOneBuildTwoFloor,
			energyAnalysisOneBuildThreeFloor,
			energyAnalysisOneBuildFourFloor,
			energyAnalysisOneBuildFiveFloor,
			energyAnalysisOneBuildEle,
			energyAnalysisTwoBuildEle,
			energyAnalysisThreeBuildEle,
		},
		data() {
			return {
				activeMenu: "",
				isShowIndex: "",
			};
		},
		onLoad(query) {
			this.activeMenu = query.activeMenu
		},
		onShow() {
			this.switchShowPage(this.activeMenu)

			// this.$refs.myChildComponentOne.setupTimer();
		},
		onReady() {
			// 隐藏导航栏
			uni.hideTabBar({});
		},
		onUnload() {
			this.$refs.myChildComponentOne.clearTimer();
		},
		methods: {
			switchShowPage(data) {
				const _this = this
				switch (data) {
					case '3-1':
						_this.isShowIndex = 'energyAnalysisThreeBuildOneFloor'
						break;
					case '3-2':
						_this.isShowIndex = 'energyAnalysisThreeBuildTwoFloor'
						break;
					case '3-3':
						_this.isShowIndex = 'energyAnalysisThreeBuildThreeFloor'
						break;
					case '3-4':
						_this.isShowIndex = 'energyAnalysisThreeBuildFourFloor'
						break;
					case '3-5':
						_this.isShowIndex = 'energyAnalysisThreeBuildFiveFloor'
						break;
					case '2-1':
						_this.isShowIndex = 'energyAnalysisTwoBuildOneFloor'
						break;
					case '2-2':
						_this.isShowIndex = 'energyAnalysisTwoBuildTwoFloor'
						break;
					case '2-3':
						_this.isShowIndex = 'energyAnalysisTwoBuildThreeFloor'
						break;
					case '2-4':
						_this.isShowIndex = 'energyAnalysisTwoBuildFourFloor'
						break;
					case '2-5':
						_this.isShowIndex = 'energyAnalysisTwoBuildFiveFloor'
						break;
					default:
					case '1-1':
						_this.isShowIndex = 'energyAnalysisOneBuildOneFloor'
						break;
					case '1-2':
						_this.isShowIndex = 'energyAnalysisOneBuildTwoFloor'
						break;
					case '1-3':
						_this.isShowIndex = 'energyAnalysisOneBuildThreeFloor'
						break;
					case '1-4':
						_this.isShowIndex = 'energyAnalysisOneBuildFourFloor'
						break;
					case '1-5':
						_this.isShowIndex = 'energyAnalysisOneBuildFiveFloor'
						break;
					case 'dg-1':
						_this.isShowIndex = 'energyAnalysisOneBuildEle'
						break;
					case 'dg-2':
						_this.isShowIndex = 'energyAnalysisTwoBuildEle'
						break;
					case 'dg-3':
						_this.isShowIndex = 'energyAnalysisThreeBuildEle'
						break;
						// 如果 expression 不匹配任何 case 值，则执行 default 子句中的代码块  
						break;
				}
			},

			goPage(url) {
				uni.navigateTo({
					url
				});
			},
		},
	};
</script>

<style lang="scss" scoped>
	page {
		background-color: #f5f5f5;
	}
</style>